<?php


/**
 * Base class that represents a query for the 'view_not_calculated_forms_report' table.
 *
 *
 *
 * @method EmpevalViewNotCalculatedFormsReportQuery orderByBonusGoalsFormId($order = Criteria::ASC) Order by the bonus_goals_form_id column
 * @method EmpevalViewNotCalculatedFormsReportQuery orderByFname($order = Criteria::ASC) Order by the fname column
 * @method EmpevalViewNotCalculatedFormsReportQuery orderByLname($order = Criteria::ASC) Order by the lname column
 * @method EmpevalViewNotCalculatedFormsReportQuery orderByEmail($order = Criteria::ASC) Order by the email column
 * @method EmpevalViewNotCalculatedFormsReportQuery orderByYear($order = Criteria::ASC) Order by the year column
 * @method EmpevalViewNotCalculatedFormsReportQuery orderByPeriod($order = Criteria::ASC) Order by the period column
 * @method EmpevalViewNotCalculatedFormsReportQuery orderByPeriodFrom($order = Criteria::ASC) Order by the period_from column
 * @method EmpevalViewNotCalculatedFormsReportQuery orderByPeriodTo($order = Criteria::ASC) Order by the period_to column
 *
 * @method EmpevalViewNotCalculatedFormsReportQuery groupByBonusGoalsFormId() Group by the bonus_goals_form_id column
 * @method EmpevalViewNotCalculatedFormsReportQuery groupByFname() Group by the fname column
 * @method EmpevalViewNotCalculatedFormsReportQuery groupByLname() Group by the lname column
 * @method EmpevalViewNotCalculatedFormsReportQuery groupByEmail() Group by the email column
 * @method EmpevalViewNotCalculatedFormsReportQuery groupByYear() Group by the year column
 * @method EmpevalViewNotCalculatedFormsReportQuery groupByPeriod() Group by the period column
 * @method EmpevalViewNotCalculatedFormsReportQuery groupByPeriodFrom() Group by the period_from column
 * @method EmpevalViewNotCalculatedFormsReportQuery groupByPeriodTo() Group by the period_to column
 *
 * @method EmpevalViewNotCalculatedFormsReportQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
 * @method EmpevalViewNotCalculatedFormsReportQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
 * @method EmpevalViewNotCalculatedFormsReportQuery innerJoin($relation) Adds a INNER JOIN clause to the query
 *
 * @method EmpevalViewNotCalculatedFormsReport findOne(PropelPDO $con = null) Return the first EmpevalViewNotCalculatedFormsReport matching the query
 * @method EmpevalViewNotCalculatedFormsReport findOneOrCreate(PropelPDO $con = null) Return the first EmpevalViewNotCalculatedFormsReport matching the query, or a new EmpevalViewNotCalculatedFormsReport object populated from the query conditions when no match is found
 *
 * @method EmpevalViewNotCalculatedFormsReport findOneByBonusGoalsFormId(int $bonus_goals_form_id) Return the first EmpevalViewNotCalculatedFormsReport filtered by the bonus_goals_form_id column
 * @method EmpevalViewNotCalculatedFormsReport findOneByFname(string $fname) Return the first EmpevalViewNotCalculatedFormsReport filtered by the fname column
 * @method EmpevalViewNotCalculatedFormsReport findOneByLname(string $lname) Return the first EmpevalViewNotCalculatedFormsReport filtered by the lname column
 * @method EmpevalViewNotCalculatedFormsReport findOneByEmail(string $email) Return the first EmpevalViewNotCalculatedFormsReport filtered by the email column
 * @method EmpevalViewNotCalculatedFormsReport findOneByYear(int $year) Return the first EmpevalViewNotCalculatedFormsReport filtered by the year column
 * @method EmpevalViewNotCalculatedFormsReport findOneByPeriod(string $period) Return the first EmpevalViewNotCalculatedFormsReport filtered by the period column
 * @method EmpevalViewNotCalculatedFormsReport findOneByPeriodFrom(string $period_from) Return the first EmpevalViewNotCalculatedFormsReport filtered by the period_from column
 * @method EmpevalViewNotCalculatedFormsReport findOneByPeriodTo(string $period_to) Return the first EmpevalViewNotCalculatedFormsReport filtered by the period_to column
 *
 * @method array findByBonusGoalsFormId(int $bonus_goals_form_id) Return EmpevalViewNotCalculatedFormsReport objects filtered by the bonus_goals_form_id column
 * @method array findByFname(string $fname) Return EmpevalViewNotCalculatedFormsReport objects filtered by the fname column
 * @method array findByLname(string $lname) Return EmpevalViewNotCalculatedFormsReport objects filtered by the lname column
 * @method array findByEmail(string $email) Return EmpevalViewNotCalculatedFormsReport objects filtered by the email column
 * @method array findByYear(int $year) Return EmpevalViewNotCalculatedFormsReport objects filtered by the year column
 * @method array findByPeriod(string $period) Return EmpevalViewNotCalculatedFormsReport objects filtered by the period column
 * @method array findByPeriodFrom(string $period_from) Return EmpevalViewNotCalculatedFormsReport objects filtered by the period_from column
 * @method array findByPeriodTo(string $period_to) Return EmpevalViewNotCalculatedFormsReport objects filtered by the period_to column
 *
 * @package    propel.generator.empeval.om
 */
abstract class EmpevalBaseViewNotCalculatedFormsReportQuery extends ModelCriteria
{
    /**
     * Initializes internal state of EmpevalBaseViewNotCalculatedFormsReportQuery object.
     *
     * @param     string $dbName The dabase name
     * @param     string $modelName The phpName of a model, e.g. 'Book'
     * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
     */
    public function __construct($dbName = 'vgp_empeval', $modelName = 'EmpevalViewNotCalculatedFormsReport', $modelAlias = null)
    {
        parent::__construct($dbName, $modelName, $modelAlias);
    }

    /**
     * Returns a new EmpevalViewNotCalculatedFormsReportQuery object.
     *
     * @param     string $modelAlias The alias of a model in the query
     * @param     EmpevalViewNotCalculatedFormsReportQuery|Criteria $criteria Optional Criteria to build the query from
     *
     * @return EmpevalViewNotCalculatedFormsReportQuery
     */
    public static function create($modelAlias = null, $criteria = null)
    {
        if ($criteria instanceof EmpevalViewNotCalculatedFormsReportQuery) {
            return $criteria;
        }
        $query = new EmpevalViewNotCalculatedFormsReportQuery();
        if (null !== $modelAlias) {
            $query->setModelAlias($modelAlias);
        }
        if ($criteria instanceof Criteria) {
            $query->mergeWith($criteria);
        }

        return $query;
    }

    /**
     * Find object by primary key.
     * Propel uses the instance pool to skip the database if the object exists.
     * Go fast if the query is untouched.
     *
     * <code>
     * $obj  = $c->findPk(12, $con);
     * </code>
     *
     * @param mixed $key Primary key to use for the query
     * @param     PropelPDO $con an optional connection object
     *
     * @return   EmpevalViewNotCalculatedFormsReport|EmpevalViewNotCalculatedFormsReport[]|mixed the result, formatted by the current formatter
     */
    public function findPk($key, $con = null)
    {
        if ($key === null) {
            return null;
        }
        if ((null !== ($obj = EmpevalViewNotCalculatedFormsReportPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
            // the object is alredy in the instance pool
            return $obj;
        }
        if ($con === null) {
            $con = Propel::getConnection(EmpevalViewNotCalculatedFormsReportPeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }
        $this->basePreSelect($con);
        if ($this->formatter || $this->modelAlias || $this->with || $this->select
         || $this->selectColumns || $this->asColumns || $this->selectModifiers
         || $this->map || $this->having || $this->joins) {
            return $this->findPkComplex($key, $con);
        } else {
            return $this->findPkSimple($key, $con);
        }
    }

    /**
     * Find object by primary key using raw SQL to go fast.
     * Bypass doSelect() and the object formatter by using generated code.
     *
     * @param     mixed $key Primary key to use for the query
     * @param     PropelPDO $con A connection object
     *
     * @return   EmpevalViewNotCalculatedFormsReport A model object, or null if the key is not found
     * @throws   PropelException
     */
    protected function findPkSimple($key, $con)
    {
        $sql = 'SELECT BONUS_GOALS_FORM_ID, FNAME, LNAME, EMAIL, YEAR, PERIOD, PERIOD_FROM, PERIOD_TO FROM view_not_calculated_forms_report WHERE BONUS_GOALS_FORM_ID = :p0';
        try {
            $stmt = $con->prepare($sql);
            $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
            $stmt->execute();
        } catch (Exception $e) {
            Propel::log($e->getMessage(), Propel::LOG_ERR);
            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
        }
        $obj = null;
        if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
            $obj = new EmpevalViewNotCalculatedFormsReport();
            $obj->hydrate($row);
            EmpevalViewNotCalculatedFormsReportPeer::addInstanceToPool($obj, (string) $key);
        }
        $stmt->closeCursor();

        return $obj;
    }

    /**
     * Find object by primary key.
     *
     * @param     mixed $key Primary key to use for the query
     * @param     PropelPDO $con A connection object
     *
     * @return EmpevalViewNotCalculatedFormsReport|EmpevalViewNotCalculatedFormsReport[]|mixed the result, formatted by the current formatter
     */
    protected function findPkComplex($key, $con)
    {
        // As the query uses a PK condition, no limit(1) is necessary.
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $stmt = $criteria
            ->filterByPrimaryKey($key)
            ->doSelect($con);

        return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
    }

    /**
     * Find objects by primary key
     * <code>
     * $objs = $c->findPks(array(12, 56, 832), $con);
     * </code>
     * @param     array $keys Primary keys to use for the query
     * @param     PropelPDO $con an optional connection object
     *
     * @return PropelObjectCollection|EmpevalViewNotCalculatedFormsReport[]|mixed the list of results, formatted by the current formatter
     */
    public function findPks($keys, $con = null)
    {
        if ($con === null) {
            $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
        }
        $this->basePreSelect($con);
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $stmt = $criteria
            ->filterByPrimaryKeys($keys)
            ->doSelect($con);

        return $criteria->getFormatter()->init($criteria)->format($stmt);
    }

    /**
     * Filter the query by primary key
     *
     * @param     mixed $key Primary key to use for the query
     *
     * @return EmpevalViewNotCalculatedFormsReportQuery The current query, for fluid interface
     */
    public function filterByPrimaryKey($key)
    {

        return $this->addUsingAlias(EmpevalViewNotCalculatedFormsReportPeer::BONUS_GOALS_FORM_ID, $key, Criteria::EQUAL);
    }

    /**
     * Filter the query by a list of primary keys
     *
     * @param     array $keys The list of primary key to use for the query
     *
     * @return EmpevalViewNotCalculatedFormsReportQuery The current query, for fluid interface
     */
    public function filterByPrimaryKeys($keys)
    {

        return $this->addUsingAlias(EmpevalViewNotCalculatedFormsReportPeer::BONUS_GOALS_FORM_ID, $keys, Criteria::IN);
    }

    /**
     * Filter the query on the bonus_goals_form_id column
     *
     * Example usage:
     * <code>
     * $query->filterByBonusGoalsFormId(1234); // WHERE bonus_goals_form_id = 1234
     * $query->filterByBonusGoalsFormId(array(12, 34)); // WHERE bonus_goals_form_id IN (12, 34)
     * $query->filterByBonusGoalsFormId(array('min' => 12)); // WHERE bonus_goals_form_id > 12
     * </code>
     *
     * @param     mixed $bonusGoalsFormId The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalViewNotCalculatedFormsReportQuery The current query, for fluid interface
     */
    public function filterByBonusGoalsFormId($bonusGoalsFormId = null, $comparison = null)
    {
        if (is_array($bonusGoalsFormId) && null === $comparison) {
            $comparison = Criteria::IN;
        }

        return $this->addUsingAlias(EmpevalViewNotCalculatedFormsReportPeer::BONUS_GOALS_FORM_ID, $bonusGoalsFormId, $comparison);
    }

    /**
     * Filter the query on the fname column
     *
     * Example usage:
     * <code>
     * $query->filterByFname('fooValue');   // WHERE fname = 'fooValue'
     * $query->filterByFname('%fooValue%'); // WHERE fname LIKE '%fooValue%'
     * </code>
     *
     * @param     string $fname The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalViewNotCalculatedFormsReportQuery The current query, for fluid interface
     */
    public function filterByFname($fname = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($fname)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $fname)) {
                $fname = str_replace('*', '%', $fname);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(EmpevalViewNotCalculatedFormsReportPeer::FNAME, $fname, $comparison);
    }

    /**
     * Filter the query on the lname column
     *
     * Example usage:
     * <code>
     * $query->filterByLname('fooValue');   // WHERE lname = 'fooValue'
     * $query->filterByLname('%fooValue%'); // WHERE lname LIKE '%fooValue%'
     * </code>
     *
     * @param     string $lname The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalViewNotCalculatedFormsReportQuery The current query, for fluid interface
     */
    public function filterByLname($lname = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($lname)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $lname)) {
                $lname = str_replace('*', '%', $lname);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(EmpevalViewNotCalculatedFormsReportPeer::LNAME, $lname, $comparison);
    }

    /**
     * Filter the query on the email column
     *
     * Example usage:
     * <code>
     * $query->filterByEmail('fooValue');   // WHERE email = 'fooValue'
     * $query->filterByEmail('%fooValue%'); // WHERE email LIKE '%fooValue%'
     * </code>
     *
     * @param     string $email The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalViewNotCalculatedFormsReportQuery The current query, for fluid interface
     */
    public function filterByEmail($email = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($email)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $email)) {
                $email = str_replace('*', '%', $email);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(EmpevalViewNotCalculatedFormsReportPeer::EMAIL, $email, $comparison);
    }

    /**
     * Filter the query on the year column
     *
     * Example usage:
     * <code>
     * $query->filterByYear(1234); // WHERE year = 1234
     * $query->filterByYear(array(12, 34)); // WHERE year IN (12, 34)
     * $query->filterByYear(array('min' => 12)); // WHERE year > 12
     * </code>
     *
     * @param     mixed $year The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalViewNotCalculatedFormsReportQuery The current query, for fluid interface
     */
    public function filterByYear($year = null, $comparison = null)
    {
        if (is_array($year)) {
            $useMinMax = false;
            if (isset($year['min'])) {
                $this->addUsingAlias(EmpevalViewNotCalculatedFormsReportPeer::YEAR, $year['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($year['max'])) {
                $this->addUsingAlias(EmpevalViewNotCalculatedFormsReportPeer::YEAR, $year['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpevalViewNotCalculatedFormsReportPeer::YEAR, $year, $comparison);
    }

    /**
     * Filter the query on the period column
     *
     * Example usage:
     * <code>
     * $query->filterByPeriod('fooValue');   // WHERE period = 'fooValue'
     * $query->filterByPeriod('%fooValue%'); // WHERE period LIKE '%fooValue%'
     * </code>
     *
     * @param     string $period The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalViewNotCalculatedFormsReportQuery The current query, for fluid interface
     */
    public function filterByPeriod($period = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($period)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $period)) {
                $period = str_replace('*', '%', $period);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(EmpevalViewNotCalculatedFormsReportPeer::PERIOD, $period, $comparison);
    }

    /**
     * Filter the query on the period_from column
     *
     * Example usage:
     * <code>
     * $query->filterByPeriodFrom('fooValue');   // WHERE period_from = 'fooValue'
     * $query->filterByPeriodFrom('%fooValue%'); // WHERE period_from LIKE '%fooValue%'
     * </code>
     *
     * @param     string $periodFrom The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalViewNotCalculatedFormsReportQuery The current query, for fluid interface
     */
    public function filterByPeriodFrom($periodFrom = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($periodFrom)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $periodFrom)) {
                $periodFrom = str_replace('*', '%', $periodFrom);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(EmpevalViewNotCalculatedFormsReportPeer::PERIOD_FROM, $periodFrom, $comparison);
    }

    /**
     * Filter the query on the period_to column
     *
     * Example usage:
     * <code>
     * $query->filterByPeriodTo('fooValue');   // WHERE period_to = 'fooValue'
     * $query->filterByPeriodTo('%fooValue%'); // WHERE period_to LIKE '%fooValue%'
     * </code>
     *
     * @param     string $periodTo The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalViewNotCalculatedFormsReportQuery The current query, for fluid interface
     */
    public function filterByPeriodTo($periodTo = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($periodTo)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $periodTo)) {
                $periodTo = str_replace('*', '%', $periodTo);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(EmpevalViewNotCalculatedFormsReportPeer::PERIOD_TO, $periodTo, $comparison);
    }

    /**
     * Exclude object from result
     *
     * @param   EmpevalViewNotCalculatedFormsReport $viewNotCalculatedFormsReport Object to remove from the list of results
     *
     * @return EmpevalViewNotCalculatedFormsReportQuery The current query, for fluid interface
     */
    public function prune($viewNotCalculatedFormsReport = null)
    {
        if ($viewNotCalculatedFormsReport) {
            $this->addUsingAlias(EmpevalViewNotCalculatedFormsReportPeer::BONUS_GOALS_FORM_ID, $viewNotCalculatedFormsReport->getBonusGoalsFormId(), Criteria::NOT_EQUAL);
        }

        return $this;
    }

}
